package com.gitee.l0km.thrift.swift2thrift.generator;
import org.stringtemplate.v4.AttributeRenderer;

import com.facebook.swift.codec.metadata.ThriftType;
import com.gitee.l0km.xthrift.base.metadata.ErpcType;

import java.util.Locale;

public class ErpcTypeRenderer implements AttributeRenderer
{	
    @Override
    public String toString(Object o, String format, Locale locale)
    {
		if(o instanceof ErpcType){
			return ((ErpcType)o).toTypeString();
		}else if(o instanceof ThriftType){
			return ErpcType.getErpcType((ThriftType)o).toTypeString();
		}
		throw new IllegalArgumentException("UNSUPPORTED Renderer type " + o.getClass().getName() + " ThriftType or ErpcType required");
        
    }


}
